<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

  <title>Class: EngineyardAPI::Environment</title>

  <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

  <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="../index.html">Home</a>
          <a href="../index.html#classes">Classes</a>
          <a href="../index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="../lib/engineyard-api/environment_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="lib/engineyard-api/environment.rb">lib/engineyard-api/environment.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link"><a href="../Object.html">Object</a></p>
        
      </div>
      

      

      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-i-5B-5D">#[]</a></li>
          
          <li><a href="#method-i-add_instance">#add_instance</a></li>
          
          <li><a href="#method-i-add_status">#add_status</a></li>
          
          <li><a href="#method-i-app_master">#app_master</a></li>
          
          <li><a href="#method-i-app_server_stack_name">#app_server_stack_name</a></li>
          
          <li><a href="#method-i-apps">#apps</a></li>
          
          <li><a href="#method-i-busy-3F">#busy?</a></li>
          
          <li><a href="#method-i-deploying-3F">#deploying?</a></li>
          
          <li><a href="#method-i-deployment_configurations">#deployment_configurations</a></li>
          
          <li><a href="#method-i-environment_id">#environment_id</a></li>
          
          <li><a href="#method-i-framework_env">#framework_env</a></li>
          
          <li><a href="#method-i-instance_count">#instance_count</a></li>
          
          <li><a href="#method-i-instance_status">#instance_status</a></li>
          
          <li><a href="#method-i-instances">#instances</a></li>
          
          <li><a href="#method-i-load_balancer_ip_address">#load_balancer_ip_address</a></li>
          
          <li><a href="#method-i-name">#name</a></li>
          
          <li><a href="#method-i-rebuild">#rebuild</a></li>
          
          <li><a href="#method-i-reload">#reload</a></li>
          
          <li><a href="#method-i-remove_instance">#remove_instance</a></li>
          
          <li><a href="#method-i-remove_status">#remove_status</a></li>
          
          <li><a href="#method-i-ssh_username">#ssh_username</a></li>
          
          <li><a href="#method-i-stack_name">#stack_name</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      
      <div id="fileindex-section" class="section project-section">
        <h3 class="section-header">Files</h3>
        <ul>
        
          <li class="file"><a href="../Gemfile.html">Gemfile</a></li>
        
          <li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
        
        </ul>
      </div>
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="../images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="../EngineyardAPI.html">EngineyardAPI</a></li>
        
          <li><a href="../EngineyardAPI/Account.html">EngineyardAPI::Account</a></li>
        
          <li><a href="../EngineyardAPI/App.html">EngineyardAPI::App</a></li>
        
          <li><a href="../EngineyardAPI/Engineyard.html">EngineyardAPI::Engineyard</a></li>
        
          <li><a href="../EngineyardAPI/Environment.html">EngineyardAPI::Environment</a></li>
        
          <li><a href="../EngineyardAPI/Instance.html">EngineyardAPI::Instance</a></li>
        
          <li><a href="../Object.html">Object</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">EngineyardAPI::Environment</h1>

    <div id="description" class="description">
      
<p><a href="Environment.html">Environment</a> class stores all environment
data, and crawls over other parts of the api to grab data for <a
href="Instance.html">Instance</a> and <a href="App.html">App</a> classes.</p>

    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      

      <!-- Methods -->
      
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="5B-5D-method" class="method-detail ">
          <a name="method-i-5B-5D"></a>

          
          <div class="method-heading">
            <span class="method-name">[]</span><span
              class="method-args">(key)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Used for development. same as keys method, but does not return a list of
keys if no params.</p>
            

            
            <div class="method-source-code" id="5B-5D-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 112</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
  <span class="ruby-ivar">@enviornment</span>[<span class="ruby-identifier">key</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- 5B-5D-source -->
            
          </div>

          

          
        </div><!-- 5B-5D-method -->

      
        <div id="add_instance-method" class="method-detail ">
          <a name="method-i-add_instance"></a>

          
          <div class="method-heading">
            <span class="method-name">add_instance</span><span
              class="method-args">(body)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Create a new instance.  first param can take any arguments in hash that API
would accept (i.e. :instance_size, :volume_size, etc)</p>
            

            
            <div class="method-source-code" id="add_instance-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 89</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_instance</span>(<span class="ruby-identifier">body</span>)
  <span class="ruby-identifier">request</span> = {<span class="ruby-value">:body</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-value">:request</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">body</span>}}
  <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">post</span>(<span class="ruby-node">&quot;#{@path}/add_instances&quot;</span>, <span class="ruby-identifier">request</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- add_instance-source -->
            
          </div>

          

          
        </div><!-- add_instance-method -->

      
        <div id="add_status-method" class="method-detail ">
          <a name="method-i-add_status"></a>

          
          <div class="method-heading">
            <span class="method-name">add_status</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Checks to see how many add instance actions are working on environment.
returns array.</p>
            

            
            <div class="method-source-code" id="add_status-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_status</span>
  <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{@path}/add_instances&quot;</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- add_status-source -->
            
          </div>

          

          
        </div><!-- add_status-method -->

      
        <div id="app_master-method" class="method-detail ">
          <a name="method-i-app_master"></a>

          
          <div class="method-heading">
            <span class="method-name">app_master</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Return <a href="Instance.html">EngineyardAPI::Instance</a> of current <a
href="Environment.html#method-i-app_master">app_master</a></p>
            

            
            <div class="method-source-code" id="app_master-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">app_master</span>
  <span class="ruby-ivar">@app_master</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- app_master-source -->
            
          </div>

          

          
        </div><!-- app_master-method -->

      
        <div id="app_server_stack_name-method" class="method-detail ">
          <a name="method-i-app_server_stack_name"></a>

          
          <div class="method-heading">
            <span class="method-name">app_server_stack_name</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns current stack name</p>
            

            
            <div class="method-source-code" id="app_server_stack_name-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 58</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">app_server_stack_name</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'app_server_stack_name'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- app_server_stack_name-source -->
            
          </div>

          

          
        </div><!-- app_server_stack_name-method -->

      
        <div id="apps-method" class="method-detail ">
          <a name="method-i-apps"></a>

          
          <div class="method-heading">
            <span class="method-name">apps</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns array of EngineyardAPI::APP’s</p>
            

            
            <div class="method-source-code" id="apps-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">apps</span>
  <span class="ruby-ivar">@applications</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- apps-source -->
            
          </div>

          

          
        </div><!-- apps-method -->

      
        <div id="busy-3F-method" class="method-detail ">
          <a name="method-i-busy-3F"></a>

          
          <div class="method-heading">
            <span class="method-name">busy?</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Checks if environment is busy. returns true and hash of actions if
instances are being added, instances are being removed, or if deploy is
ongoing.</p>
            

            
            <div class="method-source-code" id="busy-3F-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 117</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">busy?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>, {<span class="ruby-value">:add_status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">add_status</span>[<span class="ruby-string">&quot;requests&quot;</span>] , <span class="ruby-value">:remove_status</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">remove_status</span>[<span class="ruby-string">&quot;requests&quot;</span>] } <span class="ruby-keyword">if</span> <span class="ruby-identifier">add_status</span>[<span class="ruby-string">&quot;requests&quot;</span>].<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">remove_status</span>[<span class="ruby-string">&quot;requests&quot;</span>].<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- busy-3F-source -->
            
          </div>

          

          
        </div><!-- busy-3F-method -->

      
        <div id="deploying-3F-method" class="method-detail ">
          <a name="method-i-deploying-3F"></a>

          
          <div class="method-heading">
            <span class="method-name">deploying?</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Checks if environment is deploying (works for standard deploy only (i.e.
via dashboard or ey_cli utillity)</p>
            

            
            <div class="method-source-code" id="deploying-3F-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deploying?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">apps</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">last_deploy</span>[<span class="ruby-string">'finished_at'</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span> }.<span class="ruby-identifier">count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- deploying-3F-source -->
            
          </div>

          

          
        </div><!-- deploying-3F-method -->

      
        <div id="deployment_configurations-method" class="method-detail ">
          <a name="method-i-deployment_configurations"></a>

          
          <div class="method-heading">
            <span class="method-name">deployment_configurations</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="deployment_configurations-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 73</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deployment_configurations</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'deployment_configurations'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- deployment_configurations-source -->
            
          </div>

          

          
        </div><!-- deployment_configurations-method -->

      
        <div id="environment_id-method" class="method-detail ">
          <a name="method-i-environment_id"></a>

          
          <div class="method-heading">
            <span class="method-name">environment_id</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns integer containing environment ID</p>
            

            
            <div class="method-source-code" id="environment_id-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">environment_id</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'id'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- environment_id-source -->
            
          </div>

          

          
        </div><!-- environment_id-method -->

      
        <div id="framework_env-method" class="method-detail ">
          <a name="method-i-framework_env"></a>

          
          <div class="method-heading">
            <span class="method-name">framework_env</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns framework environment (i.e. “production”, or “staging”)</p>
            

            
            <div class="method-source-code" id="framework_env-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">framework_env</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'framework_env'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- framework_env-source -->
            
          </div>

          

          
        </div><!-- framework_env-method -->

      
        <div id="instance_count-method" class="method-detail ">
          <a name="method-i-instance_count"></a>

          
          <div class="method-heading">
            <span class="method-name">instance_count</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns number of instances in environment</p>
            

            
            <div class="method-source-code" id="instance_count-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 24</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">instance_count</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'instances_count'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- instance_count-source -->
            
          </div>

          

          
        </div><!-- instance_count-method -->

      
        <div id="instance_status-method" class="method-detail ">
          <a name="method-i-instance_status"></a>

          
          <div class="method-heading">
            <span class="method-name">instance_status</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns current status</p>
            

            
            <div class="method-source-code" id="instance_status-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 34</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">instance_status</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'instance_status'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- instance_status-source -->
            
          </div>

          

          
        </div><!-- instance_status-method -->

      
        <div id="instances-method" class="method-detail ">
          <a name="method-i-instances"></a>

          
          <div class="method-heading">
            <span class="method-name">instances</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns array full of EngineyardAPI::Instnaces</p>
            

            
            <div class="method-source-code" id="instances-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">instances</span>
  <span class="ruby-ivar">@instances</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- instances-source -->
            
          </div>

          

          
        </div><!-- instances-method -->

      
        <div id="load_balancer_ip_address-method" class="method-detail ">
          <a name="method-i-load_balancer_ip_address"></a>

          
          <div class="method-heading">
            <span class="method-name">load_balancer_ip_address</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Return load balancer IP address, if any.</p>
            

            
            <div class="method-source-code" id="load_balancer_ip_address-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">load_balancer_ip_address</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'load_balancer_ip_address'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- load_balancer_ip_address-source -->
            
          </div>

          

          
        </div><!-- load_balancer_ip_address-method -->

      
        <div id="name-method" class="method-detail ">
          <a name="method-i-name"></a>

          
          <div class="method-heading">
            <span class="method-name">name</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Returns String containing th eenvironment name</p>
            

            
            <div class="method-source-code" id="name-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'name'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- name-source -->
            
          </div>

          

          
        </div><!-- name-method -->

      
        <div id="rebuild-method" class="method-detail ">
          <a name="method-i-rebuild"></a>

          
          <div class="method-heading">
            <span class="method-name">rebuild</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Like pressing ‘apply’ on dashboard</p>
            

            
            <div class="method-source-code" id="rebuild-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">rebuild</span>
  <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">put</span>(<span class="ruby-node">&quot;#{@path}/update_instances&quot;</span>,{<span class="ruby-value">:body</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-string">&quot;&quot;</span>})
<span class="ruby-keyword">end</span></pre>
            </div><!-- rebuild-source -->
            
          </div>

          

          
        </div><!-- rebuild-method -->

      
        <div id="reload-method" class="method-detail ">
          <a name="method-i-reload"></a>

          
          <div class="method-heading">
            <span class="method-name">reload</span><span
              class="method-args">(e=nil)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Call environment information from API. Information is cached in class until
reload is called again. Prevents calling API when not needed.</p>
            

            
            <div class="method-source-code" id="reload-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">e</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-ivar">@environment</span> = <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">get</span>(<span class="ruby-ivar">@path</span>)[<span class="ruby-string">'environment'</span>] <span class="ruby-keyword">unless</span> <span class="ruby-identifier">e</span>
  <span class="ruby-ivar">@instances</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@applications</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-comment"># Populate instances</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'instances'</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">instance</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@instances</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">Instance</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">instance</span>)
  }
  <span class="ruby-comment"># Populate Apps</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'apps'</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@applications</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">App</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">app</span>)
  }
  <span class="ruby-ivar">@app_master</span>=<span class="ruby-constant">App</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@environment</span>[<span class="ruby-string">'app_master'</span>])
  <span class="ruby-ivar">@applications</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">app</span><span class="ruby-operator">|</span> <span class="ruby-identifier">app</span>.<span class="ruby-identifier">last_deploy</span>=<span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;/apps/#{app.app_id}/environments/#{environment_id}/deployments/last&quot;</span>)[<span class="ruby-string">'deployment'</span>] }
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- reload-source -->
            
          </div>

          

          
        </div><!-- reload-method -->

      
        <div id="remove_instance-method" class="method-detail ">
          <a name="method-i-remove_instance"></a>

          
          <div class="method-heading">
            <span class="method-name">remove_instance</span><span
              class="method-args">(remove_instance)</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Remove instance. Provide role (:app, or :util), and :amazon_id if needed.</p>
            

            
            <div class="method-source-code" id="remove_instance-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove_instance</span>(<span class="ruby-identifier">remove_instance</span>)
  <span class="ruby-identifier">request</span> = {<span class="ruby-value">:body</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-value">:request</span> =<span class="ruby-operator">&gt;</span> {<span class="ruby-value">:role</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">role</span> } } } <span class="ruby-keyword">if</span> [<span class="ruby-value">:app</span>,<span class="ruby-value">:util</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">remove_instance</span>
  <span class="ruby-identifier">request</span> = {<span class="ruby-value">:body</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-value">:request</span> =<span class="ruby-operator">&gt;</span> { <span class="ruby-value">:provisioned_id</span>  =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">remove_instance</span>.<span class="ruby-identifier">amazon_id</span> } }} <span class="ruby-keyword">unless</span> [<span class="ruby-value">:app</span>,<span class="ruby-value">:util</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">remove_instance</span>
  <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">post</span>(<span class="ruby-node">&quot;#{@path}/remove_instances&quot;</span>,<span class="ruby-identifier">request</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- remove_instance-source -->
            
          </div>

          

          
        </div><!-- remove_instance-method -->

      
        <div id="remove_status-method" class="method-detail ">
          <a name="method-i-remove_status"></a>

          
          <div class="method-heading">
            <span class="method-name">remove_status</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Same as <a href="Environment.html#method-i-add_status">add_status</a>,
except checks for instances being removed. retruns array.</p>
            

            
            <div class="method-source-code" id="remove_status-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 107</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove_status</span>
  <span class="ruby-constant">EngineyardAPI</span><span class="ruby-operator">::</span><span class="ruby-constant">API</span>.<span class="ruby-identifier">get</span>(<span class="ruby-node">&quot;#{@path}/remove_instances&quot;</span>)
<span class="ruby-keyword">end</span></pre>
            </div><!-- remove_status-source -->
            
          </div>

          

          
        </div><!-- remove_status-method -->

      
        <div id="ssh_username-method" class="method-detail ">
          <a name="method-i-ssh_username"></a>

          
          <div class="method-heading">
            <span class="method-name">ssh_username</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Default user used for deployments (usually ‘deploy’)</p>
            

            
            <div class="method-source-code" id="ssh_username-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ssh_username</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'ssh_username'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- ssh_username-source -->
            
          </div>

          

          
        </div><!-- ssh_username-method -->

      
        <div id="stack_name-method" class="method-detail ">
          <a name="method-i-stack_name"></a>

          
          <div class="method-heading">
            <span class="method-name">stack_name</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>Name of current stack associated with environment</p>
            

            
            <div class="method-source-code" id="stack_name-source">
<pre>
<span class="ruby-comment"># File lib/engineyard-api/environment.rb, line 48</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stack_name</span>
  <span class="ruby-ivar">@environment</span>[<span class="ruby-string">'stack_name'</span>]
<span class="ruby-keyword">end</span></pre>
            </div><!-- stack_name-source -->
            
          </div>

          

          
        </div><!-- stack_name-method -->

      
      </div><!-- public-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

